<template>
  <div>
    <h3>Ref</h3>
    <div>
      <Child ref="children" />
      <button @click="look">点击查看</button>
    </div>
  </div>
</template>

<script>
import Child from "./Child.vue";
export default {
  name: "Ref",
  components: { Child },
  methods: {
    look() {
      //可以直接获取到当前的组件实例
      console.log(this.$refs.children);
      // $children可以获取到所有的子组件
      console.log(this.$children, "children");
      // 当前组件树的根组件 类型于事件总线
      console.log(this.$root, "1");
    },
  },
};
</script>

<style>
</style>